package com.xydtech.framework.jwt.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

/*
 * 响应过滤器
 * @author lin
 * @version 1.0
 * @create 2023/12/19 15:44
 */
@Configuration
public class ResponseFilterConfig {
    @Bean
    FilterRegistrationBean<ResponseFilter> registrationBean() {
        FilterRegistrationBean<ResponseFilter> bean = new FilterRegistrationBean<>();
        // 设置过滤器
        bean.setFilter(new ResponseFilter());
        //设置优先级，数字越小优先级越高
        bean.setOrder(-1);
        // 设置过滤器别名
        bean.setName("ResponseFilter");
        // 设置过滤路径
        bean.setUrlPatterns(Arrays.asList("/*"));
        return bean;
    }
}
